-
-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New JSON design for query views #2118
Conversation
The datasette/datasette/views/table.py Lines 822 to 850 in c3e3ecf
Instead of: datasette/datasette/views/database.py Lines 239 to 288 in c3e3ecf
|
17 failing tests now. |
15:
|
One of the failing tests is because this URL on my local environment returns this: http://127.0.0.1:8001/_memory.json?sql=select+blah {"rows": [], "columns": [], "truncated": false} With a 200 status code. It should be an error. https://latest.datasette.io/_memory.json?sql=select+blah returns a 400 status code with the following JSON: {
"ok": false,
"database": "_memory",
"query_name": null,
"rows": [],
"truncated": false,
"columns": [],
"query": {
"sql": "select blah",
"params": {}
},
"error": "no such column: blah",
"private": false,
"allow_execute_sql": true,
"query_ms": 2.68310698447749,
"source": "tests/fixtures.py",
"source_url": "https://github.com/simonw/datasette/blob/main/tests/fixtures.py",
"license": "Apache License 2.0",
"license_url": "https://github.com/simonw/datasette/blob/main/LICENSE"
} So I need a design for what this should look like for the error case. I should consider what errors look like for alternative formats too. |
https://latest.datasette.io/_memory.csv?sql=select+blah is a blank page right now: curl -I 'https://latest.datasette.io/_memory.csv?sql=select+blah'
|
New error design: {"ok": false, "error": "Error message here", "rows": [], "columns": [], "truncated": false} I guess that means I need to add https://latest.datasette.io/fixtures/facetable.json {
"ok": true,
"next": null,
"rows": [...]
} |
This bit needs some more work: datasette/datasette/views/database.py Lines 514 to 518 in a791115
The original logic for that is from here, I need to figure out how to replicate it: datasette/datasette/views/base.py Line 368 in 5139c08
datasette/datasette/views/base.py Lines 342 to 344 in 5139c08
UPDATE: Fixed the |
11 tests left:
|
3 failures left:
|
It looks like that behaviour is only relevant to table views, and it's already implemented - https://latest.datasette.io/fixtures/roadside_attraction_characteristics links to https://latest.datasette.io/fixtures/roadside_attraction_characteristics.csv?_labels=on&_size=max |
I'm going to squash merge this even though it's a bit big, because I want a clean passing commit in the |
WIP. Refs:
📚 Documentation preview 📚: https://datasette--2118.org.readthedocs.build/en/2118/